<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        var num = Number(prompt("请输入一个数"));
        function f(num) {
            if (num%1 == 0 && num%num == 0) {
                return true;
            }else {
                return false;
            }
        }
        var num2 = f(num);
        if (num2 == true) {
            document.write("是质数");
        }else {
            document.write("不是质数");
        }

    </script>
</head>
<body>

</body>
</html>